﻿using System;
using System.Collections.Generic;
using System.Collections;

namespace Bunian.Core.BusinessObjects
{
    public enum Gender
    {
         Male = 0
        ,Female = 1
    }

    public class Contact : IPersistedObject
    {
        public virtual long Id { get; set; }
        public virtual DateTime BirthDate { get; set; }
        public virtual Gender Sex { get; set; }
        public virtual string FullName { get; set; }
        public virtual bool IsOrganization { get; set; }
        public virtual bool IsDeceased { get; set; }

        public virtual IList<ContactAddress> Addresses { get; set; }

        public virtual string GetAddressByType(AddressType Type)
        {
            if (null != this.Addresses)
            {
                foreach (ContactAddress address in this.Addresses)
                {
                    if (address.Type == Type)
                    {
                        return address.AddressDetail;
                    }
                }
            }

            return string.Empty;
        }
    }
}